<!DOCTYPE html>
<html lang="zh-cn">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="Access-Control-Allow-Origin" content="*">
		<title>我的历史观点</title>
		<link href="css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="css/index.css" />
		<!--图表插件引入-->
		<script type="text/javascript" src="js/echarts.min.js"></script>
		<!--[if lt IE 9]>
      <script src="js/html5shiv.min.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
		<style type="text/css">
			.imgs img{width: 100%;}
			.viewpoint_txt p{line-height: 2;}
			.new_txt{display: none;}
		</style>
	</head>

	<body>
		<!-- 头部导航 -->
		<header></header>
		<!--<nav class="navbar navbar-default" role="navigation">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navs">
		        <span class="sr-only">Toggle navigation</span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		        <span class="icon-bar"></span>
		      </button>
					<a class="navbar-brand" href="#"><img src="Web/切图（第五周交付）/splash-ic.png" width="55" height="55" alt="logo" id="logo_img" /></a>
				</div>
				<div class="collapse navbar-collapse" id="navs">
					<ul class="nav navbar-nav navbar-right">
						<li>
							<a href="index.html" target="_blank" class="nav_a"><span class="glyphicon li_active"><img src="Web/切图（第五周交付）/tabbar-news-f.png"/></span>热点</a>
						</li>
						<li class="active">
							<a href="viewpoint.html" target="_blank" class="nav_a"><span class="glyphicon li_active"><img src="Web/切图（第五周交付）/tabbar-paper-n.png"/></span>观点</a>
						</li>
						<li>
							<a href="data.html" target="_blank" class="nav_a"><span class="glyphicon li_active"><img src="Web/切图（第五周交付）/tabbar-numbers-n.png"/></span>数据</a>
						</li>
						<li class="dropdown">
							<a href="#" class="dropdown-toggle nav_a" data-toggle="dropdown"><span class="glyphicon"><img src="Web/切图（第五周交付）/n.png"/></span>我的 <span class="caret"></span></a>
							<ul class="dropdown-menu" role="menu">
								<li class="dropdown-header">登录</li>
								<li class="dl_style">
									<a href="javascript:void(0);" class="login_wechat">微信扫码</a>
								</li>
								<li class="dl_style">
									<a href="javascript:void(0);" class="login_phone">手机号</a>
								</li>
								<li>
									<a href="add_viewpoint.html" target="_blank">发布观点</a>
								</li>
								<li>
									<a href="my_viewpoint.html" target="_blank">历史观点</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</div>
		</nav>-->
		<!-- 头部导航结束  -->

		<div id="wx_phone">
			<!-- 手机号登陆  -->
			<div id="phone">
				<div class="modal-dialog modal_style">
					<div class="modal-content">
						<div class="modal-body">
							<p class="modal_style_title">手机登录</p>
							<form role="form">
								<div class="form-group fg">
									<a class="btn btn-info btn-sm btn-block none" id="phone_error">手机格式不正确！重新输入</a>
									<input type="text" class="form-control" id="input_Phone" placeholder="请输入手机号">
									<!--<input type="password" class="form-control" id="input_password" placeholder="请输入密码">-->
									
									<input type="text" class="form-control form-group-sm " id="input_Phone_code" placeholder="请输入验证码">
									<a class="btn btn-info btn-sm btn-block none" id="code_btn1"><span id="code_num"><i>60</i>后可重新</span>获取验证码</a>
									<input type="button" class="btn btn-primary btn-sm btn-block " id="code_btn"  data-placement="bottom" value="获取验证码" />
								</div>
								<!--<input type="button" class="btn modal_style_btn btn_next fg" value="下一步">-->
								<input type="button" class="btn btn-success btn-block modal_style_btn btn_login phone_code_login" value="登录">
								<p id="wechat_tag">
									<!--<a href="javascript:void(0)" data-toggle="modal" data-target="#PhoneCode" class="phone_code">手机验证码登录<span class="glyphicon glyphicon-play"></span></a>-->
									<a href="javascript:void(0)" data-toggle="modal" data-target="#Phone" class="phone_no fg_hide">手机号登录<span class="glyphicon glyphicon-play"></span></a>
									<a href="javascript:void(0)" data-toggle="modal" data-target="#WeChat" id="aaa" class="">微信登录<span class="glyphicon glyphicon-play"></span></a>
								</p>
							</form>
						</div>
					</div>
				</div>
			</div>
			<!-- 微信登陆  -->
			<div id="WeChat">
				<div class="modal-dialog modal_style">
					<div class="modal-content">
						<div class="modal-body">
							<p class="modal_style_title">扫码登录</p>
							<form role="form">
								<div class="form-group" id="wx">
									<img src="images/erweima.png" alt="微信扫码" />
								</div>
								<p id="wechat_tag">
									<a href="javascript:void(0)" data-target="#Phone" class="">手机登录<span class="glyphicon glyphicon-play"></span></a>
								</p>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>

		<!-- 观点内容 -->
		<!--观点内容背景颜色#f5efe4-->
		<div class="container" id="viewpoint">

		</div>
		<footer></footer>
		<script src="js/jquery1.9.1.min.js"></script>
		<script src="js/bootstrap.min.js"></script>
		<script type="text/javascript" src="js/index.js"></script>
		<!--图表插件引入-->
		<script type="text/javascript" src="js/echarts.min.js"></script>
		<script type="text/javascript">
			$("header").load("header.html");
			$("footer").load("footer.html");
			$(function() {
				if (!localStorage.token) {
					alert("请登录后进行操作！");
					$("#phone").show();
					return false;
				}
				setTimeout(function(){
//					console.log($("#navs li").length)
					$("#navs li").removeClass("active");
				},500);
				//接口
				var _href = "http://api.jjrb.grsx.cc",
					interfacelist = {
						feed: "/feed/u/",
						select_data: "/data"
					},
					u_id,u_url,u_data,n = 1,fl = true,_url = _href + interfacelist.select_data+"?";
				
				u_id = getUrlParams().id;
				
				if (u_id) {
					u_url = _href+interfacelist.feed + u_id;
					console.log(n);
					u_data = {page:n};
					scorllajax(u_url,u_data);
				} else{
					u_url = _href+interfacelist.feed;
					u_data = {token:localStorage.token,page:n};
					scorllajax(u_url,u_data);
				}
				
				//ajax按页获取观点内容
				function scorllajax(url,data) {
					
					$.ajax({
						type: "get",
						url: url,
						async: true,
						data:data,
						success: function(data) {
							if(data.length > 0) {
								data.forEach(function(e, i) {
									console.log(e);
									var descp,echarts,echarts_data;
									if (e.resources[0].descp.indexOf('??')) {
										_descp = e.resources[0].descp.split('??');
										descp = _descp[0];
//										console.log(descp);
										echarts = _descp[1];
										console.log(echarts);
										if (echarts) {
											echarts_data = JSON.parse(echarts);
										}
									} else{
										descp = e.resources[0].descp;
									}
									console.log(echarts);
									
									var htm = '<div class="col-sm-12 col-md-12 col-xs-12 viewpoint">' +
										'<img class="header_img" src="' + e.owner.head + '" />' +
										'<h2 class="viewpoint_title"><a href="viewpoint_desc.html?id=' + e.id + '" target="_blank">' + e.title + '</a></h2>' +
										'<small>来源： <span class="source"> 经济日报  </span> <span class="source_time">&nbsp;  ' + timeF(e.created) + '</span></small>' +
										'      <div class="viewpoint_txt">' + descp +
										'</div> </div>';
									$("#viewpoint").append(htm);
									if (e.resources[0].descp.indexOf('??')&&echarts) {
										urlLoad(echarts_data.id_val,_url,echarts_data.country,echarts_data.indicator,echarts_data.start,echarts_data.end);
									}
//									$(".otitle").hide();
//									$("#aa").html("");
								});
								fl = true;
							}
						}
					});
					$(document).on("scroll", function() {
						var bodyheight = $(document.body).height();
						var scorlltop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
						var viewheight = $(window).height();
//						console.log(bodyheight + " ===" + scorlltop + "=========" + viewheight);
						if((scorlltop + viewheight) >= bodyheight) {
							n++;
							if (fl) {
								console.log(n);
								if (u_id) {
//									u_url = _href+interfacelist.feed + u_id;
									u_data = {page:n};
									scorllajax(u_url,u_data);
								} else{
//									u_url = _href+interfacelist.feed;
									u_data = {token:localStorage.token,page:n};
									scorllajax(u_url,u_data);
								}
//								scorllajax(u_url,u_data);
							}
							fl=false;
						}
					});
				}
			});
		</script>

		<!--<div id="aa" style="display: none;"></div>-->
	</body>

</html>